package com.ssm.lzh.controller;

import com.github.pagehelper.PageInfo;
import com.ssm.hj.page.Page;
import com.ssm.lzh.service.JcxService;
import com.ssm.pojo.Jcx;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("/lzh")
public class JcxController {


    @Resource
    private JcxService jcxService;

    @RequestMapping("/queryAllJcx")
    @ResponseBody
    public PageInfo<Jcx> queryAllJcx(@RequestBody Page<Jcx> page){
        return this.jcxService.queryAllJcx(page);
    }


    @RequestMapping("/queryAllJcxx")
    @ResponseBody
    public List<Jcx> queryAllJcx2(){
        return this.jcxService.queryAllJcx2();
    }

    @RequestMapping("/addJcx")
    @ResponseBody
    public int addJcx(@RequestBody Jcx jcx){
        return this.jcxService.addJcx(jcx);
    }

    @RequestMapping("/UpdateJcx")
    @ResponseBody
    public int updateJcx(@RequestBody Jcx jcx){
        return this.jcxService.updateJcx(jcx);
    }

    @RequestMapping("/deleteJcx")
    @ResponseBody
    public int deleteJxc(int id){
        return this.jcxService.deleteJcx(id);
    }

    @RequestMapping("/queryJcxByPid")
    @ResponseBody
   public List<Jcx> queryJcxByPid(int pid){
        return this.jcxService.queryJcxByPid(pid);
   }
}
